package com.cadre.web.controller.officer;

import com.alibaba.fastjson.JSONArray;
import com.cadre.common.exception.CadreException;
import com.cadre.common.utils.common.DateUtils;
import com.cadre.common.utils.oldutil.DateUtil;
import com.cadre.common.utils.oldutil.*;
import com.cadre.system.domain.officer.A04;
import com.cadre.system.domain.officer.ConfernamelistEntity;
import com.cadre.system.domain.officer.DIC_ZB;
import com.cadre.system.domain.officer.ShPersonVO;
import com.cadre.system.service.A01Service;
import com.cadre.system.service.A04Service;
import com.cadre.system.service.ConfernamelistService;
import com.cadre.system.service.DIC_ZBService;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFRichTextString;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFRichTextString;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

@RequestMapping({"/reportMeet"})
@Api(value = "任免上会表Excel", tags = {"任免上会表Excel"})
@Controller
/* loaded from: ReportMeetController.class */
public class ReportMeetController {
    @Autowired
    private ConfernamelistService conService;
    @Autowired
    private ReportConfig config;
    @Autowired
    private A04Service a04Service;
    @Autowired
    private A01Service a01Service;
    @Resource
    private DIC_ZBService dIC_ZBService;
    private static LoadingCache<String, JSONArray> _CACHE;

    static {
        _CACHE = null;
        try {
            _CACHE = loadCache(new CacheLoader<String, JSONArray>() { // from class: com.tdqy.cadre.modular.profess.controller.ReportMeetController.1
                public JSONArray load(String s) throws Exception {
                    return new JSONArray();
                }
            });
        } catch (Exception e) {
            System.out.println("初始化Guava Cache出错 = " + e);
        }
    }

    private static LoadingCache<String, JSONArray> loadCache(CacheLoader<String, JSONArray> cacheLoader) {
        return CacheBuilder.newBuilder().maximumSize(1000).expireAfterAccess(1, TimeUnit.HOURS).expireAfterWrite(1, TimeUnit.HOURS).build(cacheLoader);
    }

    @PostMapping({"/put"})
    @ResponseBody
    @ApiOperation("存储:自定义花名册>>上会表")
    public ResultVO put(String key, @RequestBody JSONArray jsonArray) {
        try {
            _CACHE.put(key, jsonArray);
            return ResultVOUtil.success();
        } catch (Exception e) {
            e.printStackTrace();
            return ResultVOUtil.error(ResultEnum.CACHE_ERROR);
        }
    }

    @PostMapping({"/get"})
    @ResponseBody
    @ApiOperation("获取:自定义花名册>>上会表")
    public ResultVO get(String key) {
        try {
            return ResultVOUtil.success((JSONArray) _CACHE.get(key));
        } catch (ExecutionException e) {
            e.printStackTrace();
            return ResultVOUtil.error(ResultEnum.CACHE_ERROR);
        }
    }

    @PostMapping({"/export/cadres"})
    @ApiOperation("导出:自定义花名册>>上会表")
    public void export(@RequestParam String listVo, HttpServletResponse response) {
        if (!StringUtils.isEmpty(listVo)) {
            List<ShPersonVO> listVo2 = JSONArray.parseArray(listVo, ShPersonVO.class);
            DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy.MM.dd");
            try {
                PoiUtil.writeExcelFor03(setData((List) listVo2.stream().map(e -> {
                    ConfernamelistEntity confernamelistEntity = new ConfernamelistEntity();
                    BeanUtils.copyProperties(e, confernamelistEntity);
                    confernamelistEntity.setAssumepost(e.getAssumePost());
                    confernamelistEntity.setRemovepost(e.getRemovePost());
                    confernamelistEntity.setA0180b(e.getA0180b());
                    confernamelistEntity.setA0106b(e.getA0106b());
                    confernamelistEntity.setA0108b(e.getA0108b());
                    String a0138 = e.getA0138();
                    try {
                        if (!StringUtils.isEmpty(a0138)) {
                            if (a0138.length() == 7) {
                                a0138 = a0138 + ".01";
                            }
                            confernamelistEntity.setA0138(Date.from(LocalDate.parse(a0138, df).atStartOfDay(ZoneId.systemDefault()).toInstant()));
                        }
                        String a0185 = e.getA0185();
                        if (!StringUtils.isEmpty(a0185)) {
                            if (a0185.length() == 7) {
                                a0185 = a0185 + ".01";
                            }
                            confernamelistEntity.setA0185(Date.from(LocalDate.parse(a0185, df).atStartOfDay(ZoneId.systemDefault()).toInstant()));
                        }
                        return confernamelistEntity;
                    } catch (Exception e2) {
                        throw new CadreException(ResultEnum.EXPORT_CADRES_ERROR);
                    }
                }).collect(Collectors.toList()), "干部任免名单"), response, "干部任免名单");
            } catch (Exception e) {
                e.printStackTrace();
                throw new CadreException(ResultEnum.EXCEL_ERROR);
            }
        }
    }

    @PostMapping({"/upMeet"})
    @ApiOperation("人员列表：干部列表excel导出")
    public void upMeet(String batchId, String flag, HttpServletResponse response) throws IOException {
        Map<String, Object> map = new HashMap<>();
        if (flag.equals("0")) {
            map.put("batchid", batchId);
        } else if (flag.equals("1")) {
            map.put("oftenbatchid", batchId);
        }
        try {
            PoiUtil.writeExcelFor03(setData(this.conService.getUpMeetByMap(map), "干部任免名单"), response, "干部任免名单");
        } catch (IOException e) {
            e.printStackTrace();
            throw new CadreException(ResultEnum.EXCEL_ERROR);
        }
    }

    @PostMapping({"/upMeetByIds"})
    @ApiOperation("上报名单管理---选中导出excel")
    public void upMeetByIds(String[] flowids, HttpServletResponse response) throws IOException {
        List<String> flowidList = Arrays.asList(flowids);
        int keyToken = 0;
        int listSize = flowidList.size();
        Map<String, Object> map = new HashMap<>();
        List<ConfernamelistEntity> list = new ArrayList<>();
        List<String> tempResult = new ArrayList<>();
        for (int i = 0; i < flowidList.size(); i++) {
            keyToken++;
            tempResult.add(flowidList.get(i));
            if (keyToken == 100) {
                map.put("flowids", tempResult.toArray(new String[tempResult.size()]));
                list.addAll(this.conService.getUpMeetByMap(map));
                tempResult.clear();
                keyToken = 0;
            }
            if (i == listSize - 1 && keyToken != 100) {
                try {
                    map.put("flowids", tempResult.toArray(new String[tempResult.size()]));
                    list.addAll(this.conService.getUpMeetByMap(map));
                } catch (Exception e) {
                }
                tempResult.clear();
                keyToken = 0;
            }
        }
        try {
            PoiUtil.writeExcelFor03(setDataXlsx(list), response, "干部任免名单");
        } catch (IOException e2) {
            e2.printStackTrace();
            throw new CadreException(ResultEnum.EXCEL_ERROR);
        }
    }

    private Workbook setDataXlsx(List<ConfernamelistEntity> list) {
        Row row;
        Workbook workbook = PoiUtil.createWorkbook(this.config.getExcelShTmp());
        Sheet sheet = workbook.getSheetAt(0);
        Row rowstyle = sheet.getRow(2);
        int firstcellnum = rowstyle.getFirstCellNum();
        int lastcellnum = rowstyle.getLastCellNum();
        Cell cell = rowstyle.getCell(1);
        CellStyle style = workbook.createCellStyle();
        style.setWrapText(true);
        style.setAlignment(HorizontalAlignment.forInt( 2));
        style.setVerticalAlignment(VerticalAlignment.forInt( 1));
        style.setBorderBottom(cell.getCellStyle().getBorderBottom());
        style.setBorderLeft(cell.getCellStyle().getBorderLeft());
        style.setBorderRight(cell.getCellStyle().getBorderRight());
        style.setBorderTop(cell.getCellStyle().getBorderTop());
        Font chFont = workbook.createFont();
        chFont.setFontHeightInPoints((short) 12);
        chFont.setFontName("楷体_GB2312");
        Font ehFont = workbook.createFont();
        ehFont.setFontName("Times New Roman");
        ehFont.setFontHeightInPoints((short) 12);
        style.setFont(ehFont);
        for (int i = 0; i < list.size(); i++) {
            if (i != 0) {
                row = sheet.createRow(i + 2);
                row.setHeight(rowstyle.getHeight());
            } else {
                row = rowstyle;
            }
            int count = 1 + 1;
            row.createCell(1).setCellValue(setHSSStyle(list.get(i).getA0101(), chFont, ehFont));
            int count2 = count + 1;
            row.createCell(count).setCellValue(setHSSStyle(list.get(i).getA0183(), chFont, ehFont));
            int count3 = count2 + 1;
            row.createCell(count2).setCellValue(setHSSStyle(list.get(i).getAssumepost(), chFont, ehFont));
            int count4 = count3 + 1;
            row.createCell(count3).setCellValue(setHSSStyle(list.get(i).getRemovepost(), chFont, ehFont));
            int count5 = count4 + 1;
            row.createCell(count4).setCellValue(setHSSStyle(DateUtils.format(list.get(i).getA0185(), DateUtil.MONTG_DATE_FORMAT), chFont, ehFont));
            int count6 = count5 + 1;
            row.createCell(count5).setCellValue(setHSSStyle(list.get(i).getA0180b(), chFont, ehFont));
            int count7 = count6 + 1;
            row.createCell(count6).setCellValue(setHSSStyle(list.get(i).getA0106b(), chFont, ehFont));
            int count8 = count7 + 1;
            row.createCell(count7).setCellValue(setHSSStyle(list.get(i).getA0108(), chFont, ehFont));
            int count9 = count8 + 1;
            row.createCell(count8).setCellValue(setHSSStyle(DateUtils.format(list.get(i).getA0138(), DateUtil.MONTG_DATE_FORMAT), chFont, ehFont));
            int count10 = count9 + 1;
            row.createCell(count9).setCellValue(setHSSStyle(list.get(i).getA0184a(), chFont, ehFont));
            String o = list.get(i).getA0187() == null ? "" : list.get(i).getA0187().replace("null", "");
            String add = null;
            if (list.get(i) != null) {
                add = list.get(i).getA0189() == null ? "" : list.get(i).getA0189().replace("null", "");
            }
            if (add != "" && !o.contains(add)) {
                o = o + "\r\n" + add;
            }
            int count11 = count10 + 1;
            row.createCell(count10).setCellValue(setHSSStyle(o, chFont, ehFont));
            int count12 = count11 + 1;
            row.createCell(count11).setCellValue(setHSSStyle(list.get(i).getA0188(), chFont, ehFont));
            String o1 = list.get(i).getA0190() == null ? "" : list.get(i).getA0190().replace("null", "");
            String add1 = list.get(i).getA0192() == null ? "" : list.get(i).getA0192().replace("null", "");
            if (add1 != "" && !o1.contains(add)) {
                o1 = o1 + "\r\n" + add1;
            }
            int count13 = count12 + 1;
            row.createCell(count12).setCellValue(setHSSStyle(o1, chFont, ehFont));
            int count14 = count13 + 1;
            row.createCell(count13).setCellValue(setHSSStyle(list.get(i).getA0191(), chFont, ehFont));
            int count15 = count14 + 1;
            row.createCell(count14).setCellValue(setHSSStyle(list.get(i).getRemark(), chFont, ehFont));
            for (int j = firstcellnum; j < lastcellnum; j++) {
                row.getCell(j).setCellStyle(style);
            }
        }
        return workbook;
    }

    public XSSFRichTextString setHSSStyle(String value, Font chfont, Font enfont) {
        if (value == null || "".equals(value)) {
            return null;
        }
        XSSFRichTextString ts = new XSSFRichTextString(value);
        ts.applyFont(chfont);
        Matcher matcher = Pattern.compile("(\\d{0,4}\\.?(\\d{0,2}))").matcher(value);
        int i = 0;
        while (matcher.find()) {
            i++;
            String str = matcher.group();
            if (!str.equals("")) {
                ts.applyFont(i - 1, (i + str.length()) - 1, enfont);
            }
        }
        return ts;
    }

    private Workbook setData(List<ConfernamelistEntity> data2, String title) throws IOException {
        List<List<String>> li = formatData(data2);
        HSSFWorkbook wb = new HSSFWorkbook(PoiUtil.class.getResourceAsStream(this.config.getExcelMeet()));
        Sheet sheet = wb.getSheetAt(0);
        CellStyle cellStyle = wb.createCellStyle();
        cellStyle.setWrapText(true);
        cellStyle.setBorderBottom(BorderStyle.valueOf((short) 1));
        cellStyle.setBorderLeft(BorderStyle.valueOf((short) 1));
        cellStyle.setBorderTop(BorderStyle.valueOf((short) 1));
        cellStyle.setBorderRight(BorderStyle.valueOf((short) 1));
        cellStyle.setAlignment(HorizontalAlignment.forInt( 2));
        cellStyle.setVerticalAlignment(VerticalAlignment.forInt( 1));
        cellStyle.setDataFormat(wb.createDataFormat().getFormat("@"));
        Font font = wb.createFont();
        font.setFontName("楷体_GB2312");
        font.setFontHeightInPoints((short) 12);
        cellStyle.setFont(font);
        for (int i = 0; i < li.size(); i++) {
            Row row = sheet.createRow(i + 2);
            row.setHeight((short) 1566);
            for (int j = 0; j < li.get(i).size(); j++) {
                Cell cell = row.createCell(j);
                cell.setCellStyle(cellStyle);
                short oldsize = font.getFontHeightInPoints();
                short newsize = PoiUtil.getNewFrontSize(sheet, row, cell, li.get(i).get(j), oldsize);
                if (oldsize > newsize) {
                    CellStyle styleN = wb.createCellStyle();
                    styleN.cloneStyleFrom(cellStyle);
                    Font fontN = wb.createFont();
                    fontN.setBold(font.getBold());
                    fontN.setFontName(font.getFontName());
                    fontN.setFontHeightInPoints(newsize);
                    styleN.setFont(fontN);
                    cell.setCellStyle(styleN);
                }
                if (j == 12) {
                    String str = li.get(i).get(j);
                    if (str != null && str.length() == 4) {
                        li.get(i).set(j, str.substring(0, 2) + "\n" + str.substring(2, 4));
                    }
                    cell.setCellValue(li.get(i).get(j));
                } else if (j == 1 || j == 11 || j == 13) {
                    CellStyle styleN2 = wb.createCellStyle();
                    styleN2.cloneStyleFrom(cell.getCellStyle());
                    styleN2.setAlignment(HorizontalAlignment.forInt((short) 1));
                    cell.setCellStyle(styleN2);
                    cell.setCellValue(li.get(i).get(j));
                } else if (j == 9) {
                    CellStyle styleN3 = wb.createCellStyle();
                    styleN3.cloneStyleFrom(cell.getCellStyle());
                    String str2 = li.get(i).get(j) == null ? "" : li.get(i).get(j);
                    if (str2.length() == 7) {
                        HSSFFont font2 = wb.createFont();
                        font2.setBold(font.getBold());
                        font2.setFontName("Times New Roman");
                        font2.setFontHeightInPoints(font.getFontHeightInPoints());
                        styleN3.setFont(font2);
                        cell.setCellStyle(styleN3);
                        cell.setCellValue(str2);
                    } else if (str2.length() > 7) {
                        String[] arr = {str2.substring(0, 7), str2.substring(8, str2.length())};
                        setRichTextCellValue(cell, str2, arr, getFont(font, wb, arr));
                    } else {
                        cell.setCellValue(str2);
                    }
                } else if (j == 4 || j == 6 || j == 8) {
                    CellStyle styleN4 = wb.createCellStyle();
                    styleN4.cloneStyleFrom(cell.getCellStyle());
                    HSSFFont font22 = wb.createFont();
                    font22.setBold(font.getBold());
                    font22.setFontName("Times New Roman");
                    font22.setFontHeightInPoints(font.getFontHeightInPoints());
                    styleN4.setFont(font22);
                    cell.setCellStyle(styleN4);
                    cell.setCellValue(li.get(i).get(j));
                } else if (j == 5) {
                    String str3 = li.get(i).get(j);
                    String[] arrString = toArray(str3);
                    setRichTextCellValue(cell, str3, arrString, getFont(font, wb, arrString));
                } else {
                    cell.setCellValue(li.get(i).get(j));
                }
            }
        }
        return wb;
    }

    public String getStr(String val) {
        if (val.length() <= 1) {
            return val;
        }
        if (val.substring(0, 1).equals("\n")) {
            return val.substring(1, val.length());
        }
        return val;
    }

    public String[] toArray(String str) {
        return (str == null || "".equals(str)) ? new String[]{""} : str.trim().split("\n");
    }

    private String[] removeArrayEmpty(String[] strArray) {
        List<String> strList = Arrays.asList(strArray);
        List<String> strListNew = new ArrayList<>();
        for (int i = 0; i < strList.size(); i++) {
            if (strList.get(i) != null && !strList.get(i).equals("")) {
                strListNew.add(strList.get(i));
            }
        }
        return (String[]) strListNew.toArray(new String[strListNew.size()]);
    }

    public List<HSSFFont> getFont(Font font, HSSFWorkbook wb, String[] strs) {
        List<HSSFFont> strFontList = new ArrayList<>();
        HSSFFont font1 = wb.createFont();
        font1.setBold(font.getBold());
        font1.setFontName("楷体_GB2312");
        font1.setFontHeightInPoints(font.getFontHeightInPoints());
        HSSFFont font2 = wb.createFont();
        font2.setBold(font.getBold());
        font2.setFontName("Times New Roman");
        font2.setFontHeightInPoints(font.getFontHeightInPoints());
        Pattern.compile("[一-龥()]+");
        for (String str : strs) {
            if (Pattern.matches("[一-龥()]+", str)) {
                strFontList.add(font1);
            } else {
                strFontList.add(font2);
            }
        }
        return strFontList;
    }

    public static void setRichTextCellValue(Cell cell, String wholeStr, String[] strArray, List<HSSFFont> strFontList) {
        if (!(strArray == null || wholeStr == null || "".equals(wholeStr))) {
            String wholeStr2 = wholeStr.trim();
            HSSFRichTextString hssfRichTextString = new HSSFRichTextString(wholeStr2);
            for (int i = 0; i < strArray.length; i++) {
                hssfRichTextString.applyFont(wholeStr2.indexOf(strArray[i]), wholeStr2.indexOf(strArray[i]) + strArray[i].length(), strFontList.get(i));
            }
            cell.setCellValue(hssfRichTextString);
        }
    }

    private List<List<String>> formatData(List<ConfernamelistEntity> dataList) {
        List<List<String>> arrayList = new ArrayList<>();
        for (ConfernamelistEntity vo : dataList) {
            getA0187(vo);
            List<String> datList = new ArrayList<>();
            datList.add(formatName(vo.getA0101()));
            datList.add(vo.getA0183());
            datList.add(vo.getAssumepost());
            datList.add(vo.getRemovepost());
            datList.add(DateUtils.format(vo.getA0185(), DateUtil.MONTG_DATE_FORMAT));
            datList.add(vo.getA0180b());
            datList.add(vo.getA0106b());
            datList.add(vo.getA0108b());
            datList.add(DateUtils.format(vo.getA0138(), DateUtil.MONTG_DATE_FORMAT));
            datList.add(vo.getA0184a());
            datList.add(vo.getA0187());
            datList.add(vo.getA0188());
            datList.add(vo.getA0190());
            datList.add(vo.getA0191());
            datList.add(vo.getRemark());
            arrayList.add(datList);
        }
        return arrayList;
    }

    public String formatName(String name) {
        if (name.length() == 2) {
            return name.substring(0, 1) + "  " + name.substring(1, 2);
        }
        return name;
    }

    private String formatRudang(String str) {
        if (str == null || str.equals("")) {
            return "";
        }
        if (StrValidate.isDigit(str) && str.length() == 7) {
            return str;
        }
        if (StrValidate.isDigit(str) && str.length() == 6) {
            return str.substring(0, 4) + "." + str.substring(4, str.length());
        }
        if (StrValidate.isChinese(str)) {
            if (str.length() == 4) {
                return str.substring(0, 2) + "\n" + str.substring(2, 4);
            }
            return str.replaceAll(";", "、").replaceAll("；", "、");
        } else if (!StrValidate.isLetterDigitOrChinese(str)) {
            return "";
        } else {
            StringBuilder sb = new StringBuilder();
            if (str.contains(".")) {
                sb.append(str.substring(0, 7)).append("\n").append("(");
                sb.append(str.substring(8, str.length()).replaceAll(";", "、").replaceAll("；", "、"));
                sb.append(")");
            } else {
                sb.append(str.substring(0, 4) + "." + str.substring(4, 6)).append("\n").append("(");
                sb.append(str.substring(7, str.length()).replaceAll(";", "、").replaceAll("；", "、"));
                sb.append(")");
            }
            return sb.toString();
        }
    }

    private void getA0187(ConfernamelistEntity vo) {
        DIC_ZB dicGb6864;
        DIC_ZB dicXueli;
        A04 a04;
        if (null != vo) {
            List<A04> a04s = this.a04Service.selectList(vo.getPersonid());
            if (CollectionUtils.isNotEmpty(a04s)) {
                List<A04> qrz = (List) a04s.stream().filter(a042 -> {
                    return a042.getA0449().equals("1");
                }).collect(Collectors.toList());
                List<A04> zz = (List) a04s.stream().filter(a042 -> {
                    return a042.getA0449().equals("2");
                }).collect(Collectors.toList());
                if (CollectionUtils.isNotEmpty(qrz) && null != (a04 = qrz.stream().min(new Comparator<A04>() { // from class: com.tdqy.cadre.modular.profess.controller.ReportMeetController.2
                    public int compare(A04 o1, A04 o2) {
                        String a1 = o1.getA0460();
                        String a2 = o2.getA0460();
                        if (StringUtils.isNotBlank(a1) && a1.length() < 2) {
                            a1 = a1 + 0;
                        }
                        if (StringUtils.isNotBlank(a2) && a2.length() < 2) {
                            a2 = a2 + 0;
                        }
                        if ((StringUtils.isNotBlank(a1) ? Integer.parseInt(a1) : 0) > (StringUtils.isNotBlank(a2) ? Integer.parseInt(a2) : 0)) {
                            return 1;
                        }
                        return -1;
                    }
                }).get())) {
                    DIC_ZB dicXueli2 = this.dIC_ZBService.selectByTableNameAndCode("DIC_XUELI", a04.getA0460());
                    StringBuffer sb = new StringBuffer();
                    if (null != dicXueli2) {
                        sb.append(dicXueli2.getName());
                    }
                    sb.append("\n");
                    DIC_ZB dicGb68642 = this.dIC_ZBService.selectByTableNameAndCode("DIC_GB6864", a04.getA0463());
                    if (null != dicGb68642) {
                        sb.append(dicGb68642.getName());
                    }
                    vo.setA0187(sb.toString());
                }
                if (CollectionUtils.isNotEmpty(zz)) {
                    A04 a04XueLi = zz.stream().min(new Comparator<A04>() { // from class: com.tdqy.cadre.modular.profess.controller.ReportMeetController.3
                        public int compare(A04 o1, A04 o2) {
                            String a1 = o1.getA0460();
                            String a2 = o2.getA0460();
                            if (StringUtils.isNotBlank(a1) && a1.length() < 2) {
                                a1 = a1 + 0;
                            }
                            if (StringUtils.isNotBlank(a2) && a2.length() < 2) {
                                a2 = a2 + 0;
                            }
                            if ((StringUtils.isNotBlank(a1) ? Integer.parseInt(a1) : 0) > (StringUtils.isNotBlank(a2) ? Integer.parseInt(a2) : 0)) {
                                return 1;
                            }
                            return -1;
                        }
                    }).get();
                    A04 a04XueWei = zz.stream().min(new Comparator<A04>() { // from class: com.tdqy.cadre.modular.profess.controller.ReportMeetController.4
                        public int compare(A04 o1, A04 o2) {
                            String a1 = o1.getA0463();
                            String a2 = o2.getA0463();
                            if (StringUtils.isBlank(a1)) {
                                return -1;
                            }
                            if (StringUtils.isBlank(a2)) {
                                return 1;
                            }
                            if (a1.length() < 3) {
                                a1 = a1 + 0;
                            }
                            if (a2.length() < 3) {
                                a2 = a2 + 0;
                            }
                            if (Integer.parseInt(a1) > Integer.parseInt(a2)) {
                                return 1;
                            }
                            return -1;
                        }
                    }).get();
                    StringBuffer sb2 = new StringBuffer();
                    if (!(null == a04XueLi || null == (dicXueli = this.dIC_ZBService.selectByTableNameAndCode("DIC_XUELI", a04XueLi.getA0460())))) {
                        sb2.append(dicXueli.getName());
                    }
                    sb2.append("\n");
                    if (!(null == a04XueWei || null == (dicGb6864 = this.dIC_ZBService.selectByTableNameAndCode("DIC_GB6864", a04XueWei.getA0463())))) {
                        sb2.append(dicGb6864.getName());
                    }
                    vo.setA0190(sb2.toString());
                }
            }
        }
    }
}
